package com.cp.service;

import com.cp.repository.CodeSemanticChunk;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@CacheConfig(cacheNames = "codeSemanticChunkCache")
public interface CodeSemanticChunkService {

	@Cacheable()
	List<CodeSemanticChunk> getAll();

	@Cacheable()
	List<CodeSemanticChunk> getBySemanticChunk(String semanticChunk);

	@Cacheable
	CodeSemanticChunk getById(Integer id);

	@Cacheable
	List<CodeSemanticChunk> getByConvictionId(Integer convictionId);

	@Cacheable
	List<CodeSemanticChunk> getBySemanticChunkAndClassRelationId(String semanticChunk, Integer classRelationId);

	//传入页码是为了使用缓存
	@Cacheable
	List<CodeSemanticChunk> getByConvictionIdOrClassRelationId(Integer convictionId, Integer classRelationId, Integer pageNumber);
}
